export default {
	//数据
	data() {
		return {
			curId: 0,
			modelShow: false,
      expertInfo: {}, //专家信息
      projectCooperativeList: [], //合作信息集合
      expertWorkLogList: [], //专家日志集合
      fatherIndex:0, //一级菜单下标
		}
	},
	created() { //调用方法
		let that = this;
    let expertUuid = that.get("expertUuid");
    this.findExpert(expertUuid);
	},
	mounted() {

	},
	updated:function(){
		if(this.getParamValue("fatherIndex")){
			this.fatherIndex=this.getParamValue("fatherIndex");
		}
	},
	methods: { //写函数方法
		openModal: function(expertId, projectId) {
      this.findAllExpertWorkLog(expertId, projectId);
      this.modelShow = true;
		},
		closeModel: function() {
			this.modelShow = false;
		},
    //查询所有专家项目合作信息
		findAllProjectCooperative: function(expertId) {
      var that = this;
      that.projectCooperativeList = [];
      if (expertId != null) {
        that.$post(
          that.urls.getAllCooperationProject,
          {"expertId": expertId}
        ).then(function(res) {
          if(res.success) {
            that.projectCooperativeList = res.data;
          }
        })
      }
		},
    //查询所有专家项目工作日志
    findAllExpertWorkLog: function(expertId, projectId) {
      var that = this;
      that.expertWorkLogList = [];
      if (expertId != null && projectId != null) {
        that.$post(
          that.urls.getAllExpertWorkLog,
          {"expertId": expertId, "projectId": projectId}
        ).then(function(res) {
          if(res.success) {
            that.expertWorkLogList = res.data;
          }
        })
      }
    },
    //获取专家
    findExpert: function (uuid) {
      let that = this;
		  if (uuid != null && uuid != "") {
        //初始化专家信息
        that.$post(
          that.urls.getExpert,
          {"uuid": uuid}
        ).then(function(res) {
          if(res.success) {
            that.expertInfo = res.data;
            that.findAllProjectCooperative(that.expertInfo.id);
          }
        })
      }
    },
    //跳转到登录页面
    gotoLogin: function () {
      //跳转到登录页面
      this.$router.push({
        path: "/login",
      })
    }
	}
}
